import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path:'/',
    redirect:'/home/index' //重定向到首页
  },
  {
    path: '/home',
    name: 'home',
    component: HomeView,
    children:[
      {
        path:'index',
        component:()=>import('../views/index/IndexView.vue')
      },
      {
        path:'trip',
        component:()=>import('../views/trip/TripView.vue')
      },
      {
        path:'me',
        component:()=>import('../views/me/MeView.vue')
      }
    ]
  },
  {
    path: '/about',
    name: 'about',
    component: () => import('../views/AboutView.vue')
  },
  {
    path: '/strategy',
    name: 'strategy',
    component: () => import('../views/index/Strategy.vue')
  },
  {
    path: '/detail',
    name: 'detail',
    component: () => import('../views/trip/detail.vue')
  },
  {
    path: '/map',
    name: 'map',
    component: () => import('../components/MapContainer.vue')
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
